<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="liuhuimin">
	<title>个人信息维护</title>
	<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
	<script type="text/javascript" language="JavaScript">
		function load() {
			setPages(["detview","pwdDetail","editdetview","localeDetail"]);
			Common.initDict(localeForm.locale, [{code:'zh',text:'中文'},{code:'en',text:'英文'}]);			//初始化性别(查询form)
			showDetview();
		}
		function showDetview(){
			switchPage("detview");
			SystemMgnt.showOperator("operatordet",Common.cOperator().id);
		}
		function onEdit() {
			SystemMgnt.editOperator("editoperator",Common.cOperator().id,{
				initData:{
					name:{disabled:true},
					invalidTime:{disabled:true},
					certificateNo:{disabled:true}
				},
				isInfo:true
			});
			switchPage("editdetview");
		}
		function changePwd() {
			pwdForm.reset();
			pwdForm.uniqueId.value = Common.cOperator().uniqueId;
			pwdForm.userName.value = Common.cOperator().name;
			switchPage("pwdDetail");
		}
		 
		function changeLocale(){
			switchPage("localeDetail")
			var locale = Cookie.read('locale');
			localeForm.locale.value = locale
			
		}
		
		function saveLocale(){
			var l = localeForm.locale.value
			Cookie.write('locale', l, {path: '/', duration: 1000});
			showInformation("语言设置成功")
			switchPage("detview")
		}
		
		function savePwd() {
			if (!checkForm(pwdForm))return;
			if( pwdForm.newPwd1.value !=  pwdForm.newPwd2.value){
				showWarning("新密码和确认新密码不一致！");
				pwdForm.newPwd1.focus();
				return;
			}
			DWR.call("partyService.changePassword", pwdForm.uniqueId.value, pwdForm.newPwd2.value,pwdForm.oldPwd.value, function() {
				showInformation("修改密码成功");
				pwdForm.reset();
				switchPage("detview");
			},{disCtrl:$('saveBtn')});
		}
		function onSave(){
			SystemMgnt.saveOperator(function(oper){
				switchPage("detview");
				SystemMgnt.showOperator("operatordet",oper);
			})
		}
	</script>
</head>
<body onload="load()">
	<div class="nav">
		<div id="nav"><span class=dot>&nbsp;&nbsp;&nbsp;&nbsp;</span>个人信息维护</div>
	</div>
	<div id="detview">
		<div id="operatordet">
		</div>
		<p>
			<button type="button" onclick="onEdit()">编辑个人信息</button>
			<button type="button" onclick="changePwd();">修改密码</button>
		
		</p>
	</div>
	<div id="editdetview">
		<div id="editoperator">
		</div>
		<p>
			<button type="button" onclick="onSave()">保 存</button>
			<button type="button" onclick="switchPage('detview')">取 消</button>
		</p>
	</div>
	
	<div id="pwdDetail" style="display:none">
		<form name="pwdForm" id="pwdForm">
			<div class="form">
				<div class="formTitle">修改操作员密码</div>
				<input type="hidden" name="uniqueId">
				<table cellSpacing="0" cellPadding="4" width="100%" border="0">
					<tr>
						<td width="100">用户姓名</td>
						<td><input type="text" name="userName" readonly class="readonly"></td>
					</tr>
					<tr>
						<td>旧&nbsp;密&nbsp;码</td>
						<td><input type="password" name="oldPwd" maxlength="128" onblur="checkV(this,'password',true)"><span class="des">*</span></td>
					</tr>
					<tr>
						<td>新&nbsp;密&nbsp;码</td>
						<td>
							<input type="password" name="newPwd1" maxlength="128" onblur="checkV(this,'password',true)"><span class="des">*</span>
						</td>
					</tr>
					<tr>
						<td>重复新密码</td>
						<td>
			 			 	<input type="password" name="newPwd2" maxlength="128" onblur="checkV(this,'password',true)"><span class="des">*</span>
						</td>
					</tr>
				</table>
			</div>
			<p>
				<button type="button" name="saveBtn" onclick="savePwd()">保 存</button>
				<button type="button" onclick="switchPage('detview');">取 消</button>
			</p>
		</form>
	</div>
	
	
	<div id="localeDetail" style="display:none">
		<form name="localeForm" id="localeForm">
			<div class="form">
				<div class="formTitle">修改当前语言</div>
				<table cellSpacing="0" cellPadding="4" width="100%" border="0">
					<tr>
						<td width="100">系统语言</td>
						<td><select id="locale" name="locale"><option></option></select></td>
					</tr>
					
				</table>
			</div>
			<p>
				<button type="button" name="saveBtn" onclick="saveLocale()">保 存</button>
				<button type="button" onclick="switchPage('detview');">取 消</button>
			</p>
		</form>
	</div>
</body>
</html>